package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Setmeal;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.Set;

/**
 * @Author: WangHongKun
 * @Date: 2022/9/22 16:58
 * @Email: 2028911483@qq.com
 * @Phone: 18683977706
 */

@Mapper
public interface SetmealMapper {





    @AutoFill(value = OperationType.INSERT)
    void  add(Setmeal setmeal);


    List<SetmealVO> pageQuery(SetmealPageQueryDTO setmealPageQueryDTO);

    @Update("updateNumber  setmeal set status = #{status} where id =#{id} ")
    void StartOrStop(Long id , Integer status);


    @Select("select  * from setmeal  where  id =#{id}")
    Setmeal getBYId(Long id);


    void DeleteAll(List<Long> ids);


    SetmealVO  getById(Long id);

    @AutoFill(value = OperationType.UPDATE)
    void  Update(Setmeal setmeal);

    @Select("select * from setmeal where category_id =#{categoryId}")
    List<Setmeal>  getByCategoryId(Long categoryId);


    @Select("select  count(id)  from setmeal where status=#{status}")
    Integer  getCountByStatus(Integer status);

}
